/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gerenciadorfinanceiro.database.resources;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author eduardo
 */
@Entity
@Table(name = "outcome_source")
@NamedQueries({@NamedQuery(name = "OutcomeSource.findAll", query = "SELECT o FROM OutcomeSource o"), @NamedQuery(name = "OutcomeSource.findById", query = "SELECT o FROM OutcomeSource o WHERE o.id = :id"), @NamedQuery(name = "OutcomeSource.findByDescriptionSource", query = "SELECT o FROM OutcomeSource o WHERE o.descriptionSource = :descriptionSource"), @NamedQuery(name = "OutcomeSource.findByExpirationDay", query = "SELECT o FROM OutcomeSource o WHERE o.expirationDay = :expirationDay")})
public class OutcomeSource implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "descriptionSource")
    private String descriptionSource;
    @Basic(optional = false)
    @Column(name = "expirationDay")
    private int expirationDay;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "source")
    private Collection<Outcome> outcomeCollection;

    public OutcomeSource() {
    }

    public OutcomeSource(Integer id) {
        this.id = id;
    }

    public OutcomeSource(Integer id, String descriptionSource, int expirationDay) {
        this.id = id;
        this.descriptionSource = descriptionSource;
        this.expirationDay = expirationDay;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescriptionSource() {
        return descriptionSource;
    }

    public void setDescriptionSource(String descriptionSource) {
        this.descriptionSource = descriptionSource;
    }

    public int getExpirationDay() {
        return expirationDay;
    }

    public void setExpirationDay(int expirationDay) {
        this.expirationDay = expirationDay;
    }

    public Collection<Outcome> getOutcomeCollection() {
        return outcomeCollection;
    }

    public void setOutcomeCollection(Collection<Outcome> outcomeCollection) {
        this.outcomeCollection = outcomeCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OutcomeSource)) {
            return false;
        }
        OutcomeSource other = (OutcomeSource) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gerenciadorfinanceiro.database.resources.OutcomeSource[id=" + id + "]";
    }

}
